﻿namespace ChinaUnicom
{
    using ChinaUnicom.Models;
    using ChinaUnicom.Storage;

    public sealed class Context
    {
        public Context()
        {
            Account = new Account();
            Client = new Client();
            Package = new Package();
            Fee = new Fee();
        }

        public Account Account { get; set; }

        public Client Client { get; set; }

        public Package Package { get; set; }

        public Fee Fee { get; set; }

        public static Context Load()
        {
            Context context = JsonStorage.Read<Context>();

            if (context == null)
            {
                context = new Context();
            }

            return context;
        }

        public void Save()
        {
            JsonStorage.Write(this);
        }
    }
}
